import com.maclema.mysql.*;

import flash.events.Event;

import mx.controls.Alert;
import mx.utils.StringUtil;


public var con:Connection;
public function dbAction(val:String):Connection {
	sAction = val;
	con = dbCon.getConnection();
	if (con.connected == true) {
 		var e:Event = new Event(Event.CONNECT);
 		handleConnected(e);		
	}
	else {
		con.addEventListener(Event.CONNECT, handleConnected);	
	}
            
    //con.connect();
    return con;
}
 


public function faultHandler(info:Object, token:Object):void {
	Alert.show(token.info + ": Error: " + info);
}


// 앞뒤로 빈 문자열 제거 
public function paramCheck(val:String):String {
	if (val == null) {
		val = ""
	}	
	val = StringUtil.trim(val);
	return val;	
} 